/*
 *
 * Created on: 20.09.2012
 *
 * log_p.h
 * This file is part of KOBUS
 * 
 * Copyright (C) 2012 - Ivan Penkin, MIPT
 * grek.penkin@gmail.com
 *
 * KOBUS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * KOBUS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with KOBUS; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, 
 * Boston, MA  02110-1301  USA
 *  
 */

#ifndef LOG_P_H_
#define LOG_P_H_

#include <log.h>

#include <syslog.h>
#include <cstdarg>

namespace kobus
{

class LogPrivate: public QObject
{
    Q_OBJECT
    Q_DECLARE_PUBLIC(Log)

  public:
    LogPrivate(
           const QString & ident, int opt, int facility, QObject * parent = 0);
    virtual
    ~LogPrivate();

    inline void write(int priority, const char* format, va_list * valueList) const;
    inline void write(int priority, const QString & msg) const;

    Log * q_ptr;

  protected:
    static const int MAX_MSG_LENGTH = 512;

    QByteArray ident_char;

  private:
    explicit
    LogPrivate(QObject * parent = 0);

    Q_DISABLE_COPY(LogPrivate);
};

} /* namespace kobus */

Q_DECLARE_TYPEINFO(kobus::LogPrivate, Q_COMPLEX_TYPE);

#endif /* LOG_P_H_ */
